﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 可变参数
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = Max(3, 4, 6, 1, 4, 6, 7);
            Console.WriteLine(i);

            Console.ReadKey();
        }

        static int Max(params int[] values)
        {
            int max = 0;

            foreach (int value in values)
            {
                if (value > max)
                {
                    max = value;
                }
            }

            return max;
        }
    }
}
